#pragma once
#include <iostream>
#include <fstream>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include <sstream>

class InputManager
{
private:
	std::ifstream demand;
	std::ifstream site;
	std::ifstream qos;
	std::ifstream config;

	int timeNum, clientNum, siteNum, qosLimit;
	std::vector<std::string> clientName;
	std::vector<std::vector<int>> bandwidthDemand;
	std::vector<std::string> siteName;
	std::vector<int> bandwidthLimit;
	std::vector<std::pair<int, int>> graphSiteToClient;

	void getDemand(int& timeNum, int& clientNum, std::vector<std::string>& clientName, std::vector<std::vector<int>>& bandwidthDemand);
	void getSite(int& siteNum, std::vector<std::string>& siteName, std::vector<int>& bandwidthLimit);
	
	void getQosLimit(int& qosLimit);
	void getQosGraph(std::vector<std::pair<int, int>>& graph);

	void clear();


public:
	InputManager(std::string path);
	void freopen(std::string path);

	//
	int getTotalTime();
	// 时间timeID时，按照编号顺序将客户节点Demand放入Vector中
	void getDemands(int timeID, std::vector<int> & bandwidthDemand);
	// 按照编号顺序将边缘结点Limit放入Vector中
	void getSiteLimits(std::vector<int> &bandwidthLimit);
	// siteNum 填边缘结点数量 clientNum 填客户节点数量 graph 填边表
	void getQosGraph(int &siteNum, int &clientNum, std::vector<std::pair<int, int>>& graph);	

	friend class DataManager;
	friend class OptimizerFineTunning;
};

